package hyl.core.data;

import hyl.core.MyFun;

/**
 * 可以过期的值容器 有时间戳
 */

public class ExpValue<T> {
	long l时间戳 = 0;
	T 值 = null;

	public long getStamp() {
		return l时间戳;
	}

	public void setStamp(long stamp) {
		this.l时间戳 = stamp;
	}

	public T getValue() {
		return 值;
	}

	public void setValue(T value) {
		this.l时间戳 = MyFun.getMs();
		this.值 = value;
	}

	public ExpValue(T value) {
		this.值 = value;
		l时间戳 = MyFun.getMs();
	}

	public ExpValue(long stamp, T value) {
		this.值 = value;
		this.l时间戳 = stamp;
	}

	/*
	 * public byte[] getBytes() { JSONObject obj=new JSONObject();
	 * obj.put("s",stamp); obj.put("v",value); return JSON.toJSONBytes(obj); }
	 * public String toString() { JSONObject obj=new JSONObject();
	 * obj.put("s",stamp); obj.put("v",value); return obj.toJSONString(); }
	 * 
	 * public static TimeEntry parse(String s) { JSONObject obj =
	 * JSON.parseObject(s); long i = obj.getLongValue("s"); String o =
	 * obj.getString("v"); return new TimeEntry(i, o); } public static TimeEntry
	 * parse(byte[] input) { TimeEntry obj = JSON.parseObject(input,
	 * TimeEntry.class); return obj; }
	 */
}
